home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pbaseiv.zip / P4DBS002.TIP < prev    next >
Text File  |  1991-12-16  |  2KB  |  49 lines

  1. Pausing a dBASE program with a counter and a loop is a poor
  2. practice. A pause that's the right length on a 6-MHz AT may
  3. be too short on a 25-MHz 80386 system.
  4.  
  5. TIMEOUT.PRG [see listing] shows a better way to pause for a
  6. length of time. The program uses two variables: stime (the
  7. system time when the program begins its pause) and etime
  8. (the ending time when the program continues). An IF
  9. statement ensures that the delay will be no longer than
  10. about one minute. TIMEOUT executes a WHILE loop that ends
  11. when the current system time equals the calculated ending
  12. time.
  13.  
  14. Dan O'Brien
  15. Rolling Hills Estates, California
  16.  
  17. Editor's note: Use the Alt-F key to copy the listing below
  18. to a DOS file called TIMEOUT.PRG. Start dBASE, and at the
  19. dot prompt type DO TIMEOUT. The program displays a message,
  20. pauses for about six seconds, then displays a second
  21. message. For a longer or shorter pause, change the `6' in
  22. the fourth line to another number less than 60. Of course,
  23. you can also change the messages to suit your needs.
  24. TIMEOUT.PRG works with most dBASE compatibles.
  25.  
  26. TIMEOUT.PRG: This dBASE III Plus program creates pauses that
  27. are independent of system speed. (Extract with Alt-F)
  28.  
  29. ---- BEGIN LISTING ----
  30. set echo off
  31. set talk off
  32. stime=val(substr(time(),7,2))
  33. etime=stime + 6
  34. if etime > 59
  35.  etime=etime - 59
  36. endif
  37. @5,5 say "One moment please..."
  38. do while stime # etime
  39.  stime=val(substr(time(),7,2))
  40. enddo
  41. @5,5 say "... Your time is up!"
  42. ---- END LISTING ----
  43.  
  44. Title: Punctual Pauses
  45. Category: DBS
  46. Issue date: Mar 1991
  47. Editor: Tom Swan
  48. Supplementary files: NONE
  49.